<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>

    <style>
        .root{
            width: 300px;
            height: 300px;
            background-color: #999;
        }
        .box{
            width: 100px;
            height: 100px;
            background-color: red;
        }
    </style>
</head>
<body>

    <div class="root" id="root">
        <div class="box" id="box"></div>
    </div>

    <script>
        //mouseenter\mouseleave 和 mouseover\mouseout 的区别
        var root = document.getElementById("root");
        var box = document.getElementById("box");

        // root.onmouseenter = function(){
        //     console.log("鼠标进入了");
            
        // }

        root.onmouseover = function(){
            console.log("鼠标进入了");
            
         }
    </script>
</body>
</html>